package com.music.controller;

import com.music.dto.Result;
import com.music.entity.NewDisc;
import com.music.service.NewDiscService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/Newdisc")
public class NewDiscController {
    @Autowired
    private NewDiscService newDiscService;
    @RequestMapping("/list")
    public Result dogetlist(Integer newDiscDistrictId){
        Result result=new Result();
        NewDisc newDisc=new NewDisc();
        if(newDiscDistrictId!=null&&!"".equals(newDiscDistrictId)){
            newDisc.setNewDiscDistrictId(newDiscDistrictId);
        }
        List<NewDisc>list=new ArrayList<NewDisc>();
        list=newDiscService.findByCondition(newDisc);
        if(!list.isEmpty()){
            result.ok(list);
        }else{
            result.fail(0,"查无数据");
        }
        return result;
    }
}
